<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>订单列表</title>
    <link rel="stylesheet" type="text/css" href="css/aui.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
    <div class="order-header">
      <div class="order-user">
        <span>当前就诊人</span>
        <em><span id="ofName"></span></em>
        <i class="arrow-down"></i>
      </div>
      <div class="order-sub">
        <span>仅提供查询近180天订单</span>
      </div>
    </div>
    <div class="order-list">
      <span id="selectRegistration"></span>
      <!--<a class="order-item" href="detail.html">-->
      <!--<div class="order-item-header">-->
      <!--<h4>北京大学国际医院</h4>-->
      <!--<span>已取号</span>-->
      <!--<i class="aui-iconfont aui-icon-right"></i>-->
      <!--</div>-->

      <!--<div class="order-item-body">-->
      <!--<div class="order-item-row">-->
      <!--<span>就诊科室</span>-->
      <!--<p>胃肠外科</p>-->
      <!--</div>-->
      <!--<div class="order-item-row">-->
      <!--<span>就诊时间</span>-->
      <!--<p>2020年0512日 周二 上午</p>-->
      <!--</div>-->
      <!--<div class="order-item-row">-->
      <!--<span>挂号证件</span>-->
      <!--<p>居民身份证</p>-->
      <!--</div>-->
      <!--</div>-->
      <!--</a>-->

      <!--<a class="order-item" href="detail.html">-->
      <!--<div class="order-item-header">-->
      <!--<h4>北京大学国际医院</h4>-->
      <!--<span>已取号</span>-->
      <!--<i class="aui-iconfont aui-icon-right"></i>-->
      <!--</div>-->

      <!--<div class="order-item-body">-->
      <!--<div class="order-item-row">-->
      <!--<span>就诊科室</span>-->
      <!--<p>胃肠外科</p>-->
      <!--</div>-->
      <!--<div class="order-item-row">-->
      <!--<span>就诊时间</span>-->
      <!--<p>2020年0512日 周二 上午</p>-->
      <!--</div>-->
      <!--<div class="order-item-row">-->
      <!--<span>挂号证件</span>-->
      <!--<p>居民身份证</p>-->
      <!--</div>-->
      <!--</div>-->
      <!--</a>-->
    </div>


    <div class="order-layer" style="display:none;">
      <span id="selectOfpatient"></span>
      <!--<div class="order-layer-title">-->
      <!--<h4>选择就诊人</h4>-->
      <!--<i class="aui-iconfont aui-icon-close order-layer-close"></i>-->
      <!--</div>-->
      <!--<div class="order-layer-body">-->
      <!--<div class="order-layer-user">-->
      <!--<div class="order-layer-info">-->
      <!--<h4>张三</h4>-->
      <!--<p>54646*****2545857</p>-->
      <!--</div>-->
      <!--<i class="aui-iconfont aui-icon-right"></i>-->
      <!--</div>-->

      <!--<div class="order-layer-user">-->
      <!--<div class="order-layer-info">-->
      <!--<h4>张三</h4>-->
      <!--<p>54646*****2545857</p>-->
      <!--</div>-->
      <!--<i class="aui-iconfont aui-icon-right"></i>-->
      <!--</div>-->
      <!--</div>-->
    </div>
</body>
<script src="js/jquery.min.js"></script>
<script src="layer/layer.js"></script>
<script src="js/url.js"></script>
<script type="text/javascript">
  getName();
  function getName(){
    $.ajax({
      type:"post",
      url:getUrl()+"wechat114/registration/selectName",
      success:function (data) {
        var msg = data.data;
        $("#ofName").html(msg[0].patientName);
        undifend(msg[0].patientName);
      }
    })

  }

  function undifend(of){
    $.ajax({
      type:"post",
      url:getUrl()+"wechat114/registration/select",
      data:{"patientName":of},
      dataType:"json",
      success:function (data) {

        var msg = data.data;
        var str = "<div class=\"order-list\">";
        for (var i = 0;i < msg.length; i++) {
          str += "<a class=\"order-item\" href=\"detail.html?registrationId="+msg[i].registrationId+"\">\n" +
                  "        <div class=\"order-item-header\">\n" +
                  "          <h4>"+msg[i].registrationHospital+"</h4>\n" +
                  "          <span>已取号</span>\n" +
                  "          <i class=\"aui-iconfont aui-icon-right\"></i>\n" +
                  "        </div>\n" +
                  "\n" +
                  "        <div class=\"order-item-body\">\n" +
                  "          <div class=\"order-item-row\">\n" +
                  "            <span>就诊科室</span>\n" +
                  "            <p>"+msg[i].registrationOffices+"</p>\n" +
                  "          </div>\n" +
                  "          <div class=\"order-item-row\">\n" +
                  "            <span>就诊时间</span>\n" +
                  "            <p>2020年05月12日 周二 上午</p>\n" +
                  "          </div>\n" +
                  "          <div class=\"order-item-row\">\n" +
                  "            <span>挂号证件</span>\n" +
                  "            <p>居民身份证</p>\n" +
                  "          </div>\n" +
                  "        </div>\n" +
                  "      </a>";
        }
        str +="</div>";
        $("#selectRegistration").html(str);
      }
    })
  }

  $('.order-user').click(function () {
    var name = $(this).find('i').attr('class');
    if(name=='arrow-down'){
      $(this).find('i').removeClass('arrow-down');
      $(this).find('i').addClass('arrow-up');

      layer.open({
        type: 1,
        anim: 2,
        title: false,
        closeBtn: false,
        offset: 'b',
        area: ['100%','330px'],
        shadeClose: true,
        content: $('.order-layer'),
        end: function(index, layero){
          $.ajax({
            type:"post",
            url:getUrl()+"wechat114/registration/selectName",
            success:function (data) {
              var msg = data.data;
              var str = "<div class=\"order-layer-title\">\n" +
                      "        <h4>选择就诊人</h4>\n" +
                      "        <i class=\"aui-iconfont aui-icon-close order-layer-close\"></i>\n" +
                      "      </div><div class=\"order-layer-body\">";
              for (var i = 0;i < msg.length;i++){
                str +="<div class=\"order-layer-user\" >\n" +
                        "          <div class=\"order-layer-info\">\n" +
                        "            <h4>"+msg[i].patientName+"</h4>\n" +
                        "            <p>"+msg[i].patientIdnumber+"</p>\n" +
                        "          </div>\n" +
                        "          <i class=\"aui-iconfont aui-icon-right\"></i>\n" +
                        "        </div>"
              }
              str+="</div>"
              $("#selectOfpatient").html(str);
            }

          })
          $("div").delegate("h4","click",function () {
            $("#selectRegistration").html("");
            $("#ofName").html(this.innerHTML);
            var ooname = this.innerHTML;
            $.ajax({
              type:"post",
              url:getUrl()+"wechat114/registration/select",
              data:{"patientName":ooname},
              dataType:"json",
              success:function (data) {
                var msg = data.data;
                var str = "<div class=\"order-list\">";
                for (var i = 0;i < msg.length; i++) {
                  str += "<a class=\"order-item\" href=\"detail.html?registrationId="+msg[i].registrationId+"\">\n" +
                          "        <div class=\"order-item-header\">\n" +
                          "          <h4>"+msg[i].registrationHospital+"</h4>\n" +
                          "          <span>已取号</span>\n" +
                          "          <i class=\"aui-iconfont aui-icon-right\"></i>\n" +
                          "        </div>\n" +
                          "\n" +
                          "        <div class=\"order-item-body\">\n" +
                          "          <div class=\"order-item-row\">\n" +
                          "            <span>就诊科室</span>\n" +
                          "            <p>"+msg[i].registrationOffices+"</p>\n" +
                          "          </div>\n" +
                          "          <div class=\"order-item-row\">\n" +
                          "            <span>就诊时间</span>\n" +
                          "            <p>2020年0512日 周二 上午</p>\n" +
                          "          </div>\n" +
                          "          <div class=\"order-item-row\">\n" +
                          "            <span>挂号证件</span>\n" +
                          "            <p>居民身份证</p>\n" +
                          "          </div>\n" +
                          "        </div>\n" +
                          "      </a>";
                }
                str +="</div>";
                $("#selectRegistration").html(str);
                layer.closeAll();
              }
            })
          })


          $('.order-user').find('i').addClass('arrow-down');
          $('.order-user').find('i').removeClass('arrow-up');
        }
      });
    }
    else if(name=='arrow-up'){
      $(this).find('i').addClass('arrow-down');
      $(this).find('i').removeClass('arrow-up');
    }
  })

  $('.order-layer-close').click(function functionName() {

    layer.closeAll();
  })
</script>
</html>
